<template>
    <div class="paging">
        <!-- 分页控件 -->
        <el-row :gutter="20" class="paging">
            <el-col :span="6" :offset="8">
                <el-pagination background layout="prev, pager, next" :total="countPage" @current-change="changePage" :current-page.sync="pageIndex">
                </el-pagination>
            </el-col>
        </el-row>
    </div>
</template>
<script>
import * as API from "../http/api";

export default {
	// 父组件传递的数据
	props: ["countPage", "pageIndex"],
	components: {},
	data() {
		return {};
	},
	methods: {
		// 切换页码
		changePage(val) {
			let self = this;
			// 设置显示当前页码
			self.pageIndex = val;
			self.$emit("changePage", val);
		}
	},
	created() {
		let self = this;
	}
};
</script>
<style lang="scss" scoped>

</style>
